<?xml version="1.0" encoding="UTF-8"?>
<!-- Convert EvalJ's recall base to SQL insert statements -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="text"/>
    <xsl:template match="file">
        start transaction;
        <xsl:apply-templates/>
        commit;
    </xsl:template>
    <xsl:template match="element">
        insert into relevance(topic, fragmentid, exh, spec) values (<xsl:value-of select="../../@topic-id"/>,
        (select f.id from fragment f, xpath x, document d where d.id = f.docid and f.xpathid = x.id and x.xpath ='<xsl:value-of select="@xpath"/>' and d.name='<xsl:value-of select="../@name"/>'),
            <xsl:value-of select="@e"/>, <xsl:value-of select="@s"/>);
    </xsl:template>
</xsl:stylesheet>
